/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.src.ptit.javatraining.huynh.btvn2;

import java.io.BufferedReader;
import java.io.FileReader;
import java.math.BigInteger;

/**
 *
 * @author user
 */
public class Bai4 {

    public static void main(String[] args) {
        String s1, s2;
        try {
            FileReader f4 = new FileReader("Bai4.in");
            BufferedReader fin = new BufferedReader(f4);
            s1 = fin.readLine();
            if (s1.length() < 1) {
                throw new Exception("Null Pointer");
            }
            BigInteger a = new BigInteger(s1);
            s2 = fin.readLine();
            if (s2.length() < 1) {
                throw new Exception("Null Pointer");
            }
            BigInteger b = new BigInteger(s2);
            BigInteger sum, sub, mul, div;
            sum = a.add(b);
            System.out.println("Tong = " + sum);
            sub = a.subtract(b);
            System.out.println("Hieu = " + sub);
            mul = a.multiply(b);
            System.out.println("Tich = " + mul);
            BigInteger tmp = new BigInteger("0");
            if (b.equals(tmp)) {
                throw new Exception("So chia = 0 !");
            } else {
                div = a.divide(b);
            }
            System.out.println("Thuong = " + div);

        } catch (Exception e) {
            System.out.println("Error " + e);
        }
    }
}
